using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using JGSY.CMS.LowCode.Platform.Domain.Interfaces;

namespace JGSY.CMS.LowCode.Platform.Domain.Entities
{
    /// <summary>
    /// 风险评估记录实体
    /// 用于存储用户行为的风险评估结果和相关数据
    /// </summary>
    [Table("RiskAssessments")]
    public class RiskAssessment : ITenantEntity
    {
        /// <summary>
        /// 风险评估记录标识符
        /// </summary>
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 用户标识符
        /// 被评估的用户ID
        /// </summary>
        [Required]
        public long UserId { get; set; }

        /// <summary>
        /// 评估时间戳
        /// 风险评估执行的具体时间
        /// </summary>
        [Required]
        public DateTime Timestamp { get; set; }

        /// <summary>
        /// 风险评分
        /// 综合风险评分，范围通常为0-100
        /// </summary>
        [Required]
        public double Score { get; set; }

        /// <summary>
        /// 设备信息
        /// 用户使用的设备相关信息
        /// </summary>
        public string? DeviceInfo { get; set; }
        
        /// <summary>
        /// 登录IP地址
        /// 用户登录时使用的IP地址
        /// </summary>
        public string? LoginIp { get; set; }
        
        /// <summary>
        /// 风险因素
        /// 以JSON格式存储的具体风险因素分析结果
        /// </summary>
        public string? RiskFactors { get; set; }
        
        /// <summary>
        /// 备注信息
        /// 风险评估的额外说明或标注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 租户标识符
        /// </summary>
        public string TenantId { get; set; } = string.Empty;
    }
}
